home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / Misc / DXSetup / setup1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-08  |  24.5 KB  |  650 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSetup1 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00400000&
  5.    BorderStyle     =   0  'None
  6.    ClientHeight    =   1770
  7.    ClientLeft      =   225
  8.    ClientTop       =   1590
  9.    ClientWidth     =   7950
  10.    ClipControls    =   0   'False
  11.    DrawStyle       =   5  'Transparent
  12.    FillStyle       =   0  'Solid
  13.    BeginProperty Font 
  14.       Name            =   "Times New Roman"
  15.       Size            =   24
  16.       Charset         =   0
  17.       Weight          =   700
  18.       Underline       =   0   'False
  19.       Italic          =   -1  'True
  20.       Strikethrough   =   0   'False
  21.    EndProperty
  22.    ForeColor       =   &H00000000&
  23.    HasDC           =   0   'False
  24.    Icon            =   "setup1.frx":0000
  25.    LockControls    =   -1  'True
  26.    MaxButton       =   0   'False
  27.    MinButton       =   0   'False
  28.    NegotiateMenus  =   0   'False
  29.    PaletteMode     =   1  'UseZOrder
  30.    ScaleHeight     =   118
  31.    ScaleMode       =   3  'Pixel
  32.    ScaleWidth      =   530
  33.    WindowState     =   2  'Maximized
  34.    Begin VB.Label lblModify 
  35.       AutoSize        =   -1  'True
  36.       BorderStyle     =   1  'Fixed Single
  37.       Caption         =   $"setup1.frx":0442
  38.       BeginProperty Font 
  39.          Name            =   "MS Sans Serif"
  40.          Size            =   8.25
  41.          Charset         =   0
  42.          Weight          =   400
  43.          Underline       =   0   'False
  44.          Italic          =   0   'False
  45.          Strikethrough   =   0   'False
  46.       EndProperty
  47.       Height          =   450
  48.       Left            =   15
  49.       TabIndex        =   1
  50.       Top             =   15
  51.       Visible         =   0   'False
  52.       Width           =   7860
  53.       WordWrap        =   -1  'True
  54.    End
  55.    Begin VB.Label lblDDE 
  56.       AutoSize        =   -1  'True
  57.       BorderStyle     =   1  'Fixed Single
  58.       Caption         =   "This label is used for DDE connection to the Program Manager"
  59.       BeginProperty Font 
  60.          Name            =   "MS Sans Serif"
  61.          Size            =   8.25
  62.          Charset         =   0
  63.          Weight          =   400
  64.          Underline       =   0   'False
  65.          Italic          =   0   'False
  66.          Strikethrough   =   0   'False
  67.       EndProperty
  68.       Height          =   255
  69.       Left            =   15
  70.       TabIndex        =   0
  71.       Top             =   1515
  72.       Visible         =   0   'False
  73.       Width           =   4485
  74.    End
  75. Attribute VB_Name = "frmSetup1"
  76. Attribute VB_GlobalNameSpace = False
  77. Attribute VB_Creatable = False
  78. Attribute VB_PredeclaredId = True
  79. Attribute VB_Exposed = False
  80. Option Explicit
  81. ' Can't put this is a resource because it indicated resource load failure, must localize separately
  82. Private Const mstrRESOURCELOADFAIL$ = "An error occurred while initializing string resources used by Setup."
  83. '-----------------------------------------------------------
  84. ' SUB: DrawBackGround
  85. ' Draws the 'blue wash' screen and prints the 'shadowed'
  86. ' app setup title
  87. '-----------------------------------------------------------
  88. Private Sub DrawBackGround()
  89.     Const intBLUESTART% = 255
  90.     Const intBLUEEND% = 0
  91.     Const intBANDHEIGHT% = 2
  92.     Const intSHADOWSTART% = 8
  93.     Const intSHADOWCOLOR% = 0
  94.     Const intTEXTSTART% = 4
  95.     Const intTEXTCOLOR% = 15
  96.     Const intRed% = 1
  97.     Const intGreen% = 2
  98.     Const intBlue% = 4
  99.     Const intBackRed% = 8
  100.     Const intBackGreen% = 16
  101.     Const intBackBlue% = 32
  102.     Dim sngBlueCur As Single
  103.     Dim sngBlueStep As Single
  104.     Dim intFormHeight As Integer
  105.     Dim intFormWidth As Integer
  106.     Dim intY As Integer
  107.     Dim iColor As Integer
  108.     Dim iRed As Single, iBlue As Single, iGreen As Single
  109.     '
  110.     'Get system values for height and width
  111.     '
  112.     intFormHeight = ScaleHeight
  113.     intFormWidth = ScaleWidth
  114.     If Len(ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_COLOR)) = 0 Then
  115.         iColor = intBlue
  116.     Else
  117.         iColor = CInt(ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_COLOR))
  118.     End If
  119.     'Calculate step size and blue start value
  120.     '
  121.     sngBlueStep = intBANDHEIGHT * (intBLUEEND - intBLUESTART) / intFormHeight
  122.     sngBlueCur = intBLUESTART
  123.     '
  124.     'Paint blue screen
  125.     '
  126.     For intY = 0 To intFormHeight Step intBANDHEIGHT
  127.         If iColor And intBlue Then iBlue = sngBlueCur
  128.         If iColor And intRed Then iRed = sngBlueCur
  129.         If iColor And intGreen Then iGreen = sngBlueCur
  130.         If iColor And intBackBlue Then iBlue = 255 - sngBlueCur
  131.         If iColor And intBackRed Then iRed = 255 - sngBlueCur
  132.         If iColor And intBackGreen Then iGreen = 255 - sngBlueCur
  133.         Line (-1, intY - 1)-(intFormWidth, intY + intBANDHEIGHT), RGB(iRed, iGreen, iBlue), BF
  134.         sngBlueCur = sngBlueCur + sngBlueStep
  135.     Next intY
  136.     '
  137.     'Print 'shadowed' appname
  138.     '
  139.     CurrentX = intSHADOWSTART
  140.     CurrentY = intSHADOWSTART
  141.     ForeColor = QBColor(intSHADOWCOLOR)
  142.     Print Caption
  143.     CurrentX = intTEXTSTART
  144.     CurrentY = intTEXTSTART
  145.     ForeColor = QBColor(intTEXTCOLOR)
  146.     Print Caption
  147. End Sub
  148. Private Sub Form_Load()
  149. ' Most of the work for Setup1 takes place in Form_Load()
  150. ' and is mostly driven by the information found in the
  151. ' SETUP.LST file.  To customize the Setup1 functionality,
  152. ' you will generally want to modify SETUP.LST.
  153. ' Particularly, information regarding the files you are
  154. ' installing is all stored in SETUP.LST.  Exceptions include
  155. ' the Remote Automation files RacMgr32.Exe and AutMgr32.Exe
  156. ' and special redistributable packages such as mdac_typ.exe.
  157. ' These require special handling below.
  158. ' Some customization can also be done by editing the code
  159. ' below in Form_Load or in other parts of this program.
  160. ' Places that are more likely to need customization are
  161. ' documented with suggestions and examples in the code.
  162.     '
  163.     'Uncomment these three lines for debugging.  To debug:
  164.     '1) Rebuild Setup1.exe and rebuild the cab file
  165.     '   to include the new Setup1.exe.
  166.     '2) Run setup.exe against the new cab
  167.     '3) When the message box appears, open the Setup1 project
  168.     '   in VB, paste the command line from the clipboard into the
  169.     '   Project/Properties/Make/Command Line Arguments field.
  170.     '4) F5 in VB.
  171.     '
  172.     'Clipboard.Clear
  173.     'Clipboard.SetText Command$
  174.     'MsgBox Command$
  175.     Const fDefCreateGroupUnderWin95 = False
  176.     Dim strGroupName As String                              'Name of Program Group
  177.     Dim oFont As StdFont
  178.     Dim lChar As Long
  179.     Dim cIcons As Integer            ' Count of how many icons are required.
  180.     Dim cGroups As Integer           ' Count of how many groups are required.
  181.     Dim fCreateGroup As Boolean
  182.     Dim iLoop As Integer
  183.     Dim sUCASEStartMenuKey As String
  184.     Dim sUCASEProgramsMenuKey As String
  185.     Dim sGroup As String
  186.     Dim strRemAutGroupName As String
  187.     Dim strPerAppPath As String
  188.     Dim iRet As Integer
  189.     gfRegDAO = False
  190.     On Error GoTo MainError
  191.     SetFormFont Me
  192.     'All the controls and the form are sharing the
  193.     'same font object, so create a new font object
  194.     'for the form so that the appearance of all the
  195.     'controls are not changed also
  196.     Set oFont = New StdFont
  197.     With oFont
  198.         .Size = 24
  199.         .Bold = True
  200.         .Italic = True
  201.         .Charset = lblModify.Font.Charset
  202.         .Name = lblModify.Font.Name
  203.     End With
  204.     Set Font = oFont
  205.     '
  206.     'Initialize string resources used by global vars and forms/controls
  207.     '
  208.     GetStrings
  209.     '
  210.     'Get Windows, Windows\Fonts, and Windows\System directories
  211.     '
  212.     gstrWinDir = GetWindowsDir()
  213.     gstrWinSysDir = GetWindowsSysDir()
  214.     gstrFontDir = GetWindowsFontDir()
  215.     '
  216.     ' If the Windows System directory is a subdirectory of the
  217.     ' Windows directory, the proper place for installation of
  218.     ' files specified in the setup.lst as $(WinSysDest) is always
  219.     ' the Windows \System directory.  If the Windows \System
  220.     ' directory is *not* a subdirectory of the Windows directory,
  221.     ' then the user is running a shared version of Windows.  In
  222.     ' this case, if the user does not have write access to the
  223.     ' shared system directory, we change the system files
  224.     ' destination to the windows directory
  225.     '
  226.     ' Avoid Option Compare Text and use explicit UCase comparisons because there
  227.     ' is a Unicode character (&H818F) which is equal to a path separator when
  228.     ' using Option Compare Text.
  229.     If InStr(UCase$(gstrWinSysDir), UCase$(gstrWinDir)) <> 1 Then
  230.         If Not WriteAccess(gstrWinSysDir) Then
  231.             gstrWinSysDir = gstrWinDir
  232.         End If
  233.     End If
  234.     '
  235.     ' The command-line arguments must be processed as early
  236.     ' as possible, because without them it is impossible to
  237.     ' call the app removal program to clean up after an aborted
  238.     ' setup.
  239.     '
  240. #If SMS Then
  241.     ProcessCommandLine Command$, gfSilent, gstrSilentLog, gfSMS, gstrMIFFile, gstrSrcPath, gstrAppRemovalLog, gstrAppRemovalEXE
  242.     gfNoUserInput = (gfSilent Or gfSMS)
  243. #Else
  244.     ProcessCommandLine Command$, gfSilent, gstrSilentLog, gstrSrcPath, gstrAppRemovalLog, gstrAppRemovalEXE
  245.     gfNoUserInput = gfSilent
  246. #End If
  247.     AddDirSep gstrSrcPath
  248.     '
  249.     ' The Setup Bootstrapper (SETUP.EXE) copies SETUP1.EXE and SETUP.LST to
  250.     ' the end user's windows directory.  Information required for setup such
  251.     ' as setup flags and fileinfo is read from the copy of SETUP.LST found in
  252.     ' that directory.
  253.     '
  254.     gstrSetupInfoFile = gstrWinDir & gstrFILE_SETUP
  255.     'Get the Appname (this will be shown on the blue wash screen)
  256.     gstrAppName = ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_APPNAME)
  257.     gintCabs = CInt(ReadIniFile(gstrSetupInfoFile, gstrINI_BOOT, gstrINI_CABS))
  258.     If Len(gstrAppName) = 0 Then
  259.         MsgError ResolveResString(resNOSETUPLST), vbOKOnly Or vbCritical, gstrSETMSG
  260.         gstrTitle = ResolveResString(resSETUP, gstrPIPE1, gstrAppName)
  261.         ExitSetup Me, gintRET_FATAL
  262.     End If
  263.     gstrAppExe = ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_APPEXE)
  264.     gstrTitle = ResolveResString(resSETUP, gstrPIPE1, gstrAppName)
  265.     If gfSilent Then LogSilentMsg gstrTitle & vbCrLf
  266.     'Get a temporary directory to use
  267.     gsTEMPDIR = String$(255, 0)
  268.     lChar = GetTempPath(255, gsTEMPDIR)
  269.     gsTEMPDIR = Left$(gsTEMPDIR, lChar)
  270.     AddDirSep gsTEMPDIR
  271.     gsTEMPDIR = gsTEMPDIR & ReadIniFile(gstrSetupInfoFile, gstrINI_BOOT, gsINI_TEMPDIR)
  272.     AddDirSep gsTEMPDIR
  273.     '
  274.     ' Get the name of the CAB
  275.     '
  276.     gsCABFULLNAME = gstrWinDir & ReadIniFile(gstrSetupInfoFile, gstrINI_BOOT, gstrINI_CABNAME)
  277.     '
  278.     ' Display the background "blue-wash" setup screen as soon as we get the title
  279.     '
  280.     ShowMainForm
  281.     '
  282.     ' Display the welcome dialog
  283.     '
  284.     ShowWelcomeForm
  285.     '
  286.     ' If this flag is set, then the default destination directory is used
  287.     ' without question, and the user is never given a chance to change it.
  288.     ' This is intended for installing an .EXE/.DLL as a component rather
  289.     ' than as an application in an application directory.  In this case,
  290.     ' having an application directory does not really make sense.
  291.     '
  292.     If ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_FORCEUSEDEFDEST) = "1" Then
  293.         gfForceUseDefDest = True
  294.     End If
  295.     '
  296.     ' Read default destination directory.  If the name specified conflicts
  297.     ' with the name of a file, then prompt for a new default directory
  298.     '
  299.     gstrDestDir = ResolveDestDir(ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_APPDIR))
  300.     Do While FileExists(gstrDestDir) Or Len(gstrDestDir) = 0
  301.         If MsgError(ResolveResString(resBADDEFDIR), vbOKCancel Or vbQuestion, gstrSETMSG) = vbCancel Then
  302.             ExitSetup Me, gintRET_FATAL
  303.         End If
  304.         If gfNoUserInput Then
  305.             ExitSetup Me, gintRET_FATAL
  306.         Else
  307.             ShowPathDialog
  308.         End If
  309.     Loop
  310.     '
  311.     ' Ensure a trailing backslash on the destination directory
  312.     '
  313.     AddDirSep gstrDestDir
  314.     Do
  315.         '
  316.         ' Display install button and default directory.  The user
  317.         ' can change the destination directory from here.
  318.         '
  319.         ShowBeginForm
  320.         '
  321.         ' This would be a good place to display an option dialog, allowing the user
  322.         ' a chance to select installation options: samples, docs, help files, etc.
  323.         ' Results of this dialog would be checked in the loop below
  324.         '
  325.         'ShowOptionsDialog (Function you could write with option check boxes, etc.)
  326.         '
  327.         '
  328.         ' Initialize "table" of drives used and disk space array
  329.         '
  330.         InitDiskInfo
  331.         SetMousePtr vbHourglass
  332.         ShowStaticMessageDialog ResolveResString(resDISKSPACE)
  333.         '
  334.         ' For every section in SETUP.LST that will be installed, call CalcDiskSpace
  335.         ' with the name of the section
  336.         '
  337.         CalcDiskSpace gstrINI_FILES
  338.         'CalcDiskSpace "MySection"
  339.         'CalcDiskSpace "MyOtherSection"
  340.         '
  341.         ' If you created an options dialog, you need to check results here to
  342.         ' determine whether disk space needs to be calculated (if the option(s)
  343.         ' will be installed)
  344.         '
  345.         'If chkInstallSamples.Value then
  346.         '    CalcDiskSpace "Samples"
  347.         'End If
  348.         '
  349.         HideStaticMessageDialog
  350.         SetMousePtr vbDefault
  351.     '
  352.     ' After all CalcDiskSpace calls are complete, call CheckDiskSpace to check
  353.     ' the results and display warning form (if necessary).  If the user wants
  354.     ' to try another destination directory (or cleanup and retry) then
  355.     ' CheckDiskSpace will return False
  356.     '
  357.     Loop Until CheckDiskSpace()
  358.     '
  359.     ' Starts logging to the setup logfile (will be used for application removal)
  360.     '
  361.     EnableLogging gstrAppRemovalLog
  362.     '
  363.     ' Should go ahead and force the application directory to be created,
  364.     ' since the application removal logfile will later be copied there.
  365.     '
  366.     MakePath gstrDestDir, False 'User may not ignore errors here
  367.     '
  368.     ' Create the main program group if one is wanted/needed.
  369.     '
  370.     '
  371.     ' If fDefCreateGroupUnderWin95 is set to False (this is the default), then no
  372.     ' program group will be created under Win95 unless it is absolutely necessary.
  373.     '
  374.     ' By default under Windows 95, no group should be created, and the
  375.     ' single program icon should be placed directly under the
  376.     ' Start>Programs menu (unless there are other, user-defined icons to create
  377.     '
  378.     '
  379.     ' Read through the SETUP.LST file and determine how many icons are needed.
  380.     '
  381.     cIcons = CountIcons(gsICONGROUP)
  382.     cGroups = CountGroups(gsICONGROUP)
  383.     '
  384.     ' Do the same for other sections in SETUP.LST if you've added your own.
  385.     '
  386.     'cIcons = cIcons + CountIcons("MySection")
  387.     'cIcons = cIcons + CountIcons("MyOtherSection")
  388.     '
  389.     ' The following variable determines whether or not we create a program
  390.     ' group for icons.  It is controlled by fNoGroupUnderWin95,
  391.     ' fAdditionalIcons, and FTreatAsWin95().
  392.     '
  393.     fCreateGroup = (cGroups > 0)
  394.     If fCreateGroup Then
  395.         For iLoop = 0 To cGroups - 1
  396.             sGroup = GetGroup(gsICONGROUP, iLoop)
  397.             strGroupName = vbNullString
  398.             Select Case UCase$(sGroup)
  399.                 Case UCase$(gsSTARTMENUKEY), UCase$(gsPROGMENUKEY)
  400.                     ' Skip start menu and programs - they're already there and don't
  401.                     ' need to be created.
  402.                 Case Else
  403.                     strGroupName = frmGroup.GroupName(frmSetup1, sGroup, GetPrivate(gsICONGROUP, iLoop), GetStart(gsICONGROUP, iLoop))
  404.                     If UCase$(sGroup) <> UCase$(strGroupName) Then
  405.                         SetGroup gsICONGROUP, iLoop, strGroupName
  406.                     End If
  407.             End Select
  408.             fMainGroupWasCreated = True
  409.         Next
  410.     End If
  411.     ' Before we begin copying files, check for mdac_typ
  412.     ' and if we find it, spawn that off first.  We will tell
  413.     ' it to never reboot, and check at the end to see if we need to.
  414.     DoEvents
  415.     If CheckDataAccess Then
  416.         'We need to install data access.  Display message.
  417.         ShowStaticMessageDialog ResolveResString(resINSTALLADO)
  418.         InstallDataAccess
  419.         HideStaticMessageDialog
  420.     End If
  421.     '
  422.     ' Show copy form and set copy gauge percentage to zero
  423.     '
  424.     SetMousePtr vbHourglass
  425.     ShowCopyDialog
  426.     UpdateStatus frmCopy.picStatus, 0, True
  427.     '
  428.     ' Always start with Disk #1
  429.     '
  430.     gintCurrentDisk = 1
  431.     '
  432.     ' For every section in SETUP.LST that needs to be installed, call CopySection
  433.     ' with the name of the section
  434.     '
  435.     CopySection gstrINI_FILES
  436.     'CopySection "MySection"
  437.     'CopySection "MyOtherSection"
  438.         
  439.     '
  440.     ' If you created an options dialog, you need to check results here to
  441.     ' determine whether to copy the files in the particular section(s).
  442.     '
  443.     'If chkInstallSamples.Value then
  444.     '    CopySection "Samples"
  445.     'End If
  446.     '
  447.     UpdateStatus frmCopy.picStatus, 1, True
  448.     HideCopyDialog
  449.     '
  450.     ' Now, do all the 'invisible' update things that are required
  451.     '
  452.     SetMousePtr vbDefault
  453.     ShowStaticMessageDialog ResolveResString(resUPDATING)
  454.     '
  455.     ' Register all the files that have been saved in the registration array.  The
  456.     ' CopySection API adds a registration entry (when required) if a file is copied.
  457.     '
  458.     RegisterFiles
  459.     '
  460.     ' Register all the licenses that appear in the [Licenses] section of
  461.     ' Setup.lst.
  462.     '
  463.     RegisterLicenses
  464.     '
  465.     ' If any DAO files were installed, we need to add some special
  466.     ' keys to the registry to support it so that links will work
  467.     ' in OLE Database fields.
  468.     '
  469.     If gfRegDAO Then
  470.         RegisterDAO
  471.     End If
  472.     CheckForAndInstallDirectX gstrINI_FILES, Me.hWnd
  473.     '
  474.     ' Create program icons (or links, i.e. shortcuts).
  475.     '
  476.     If fMainGroupWasCreated Or (cIcons > 0) Then
  477.         ShowStaticMessageDialog ResolveResString(resPROGMAN)
  478.         CreateIcons gsICONGROUP
  479.         '
  480.         ' Do the same for other sections in SETUP.LST if you've added your own.
  481.         '
  482.         'CreateIcons "MySection"
  483.         'CreateIcons "MyOtherSection"
  484.         '
  485.     End If
  486.     '
  487.     ' Create a separate program group and icons for the Remote Automation
  488.     ' Connection Manager and the Automation Manager, if either has been
  489.     ' installed.
  490.     ' This program group is entirely separate from the one created for the
  491.     ' application program (if any), because it will be shared by all
  492.     ' VB applications which install them.
  493.     '
  494.     ' NOTE: This is NOT the place to install additional icons.  This is
  495.     ' NOTE: handled after the Remote Automation icons have been created.
  496.     '
  497.     ShowStaticMessageDialog ResolveResString(resPROGMAN)
  498.     If Len(gsDest.strAUTMGR32) > 0 Or Len(gsDest.strRACMGR32) > 0 Then
  499.         'At least one of these programs was installed.  Go ahead
  500.         'and create the program group.
  501.         strRemAutGroupName = ResolveResString(resREMAUTGROUPNAME)
  502.         '
  503.         ' Create the group for the Remote Automation Icons.  Note that
  504.         ' since the user cannot choose the name of this group, there is
  505.         ' no way at this point to correct an error if one occurs.  Therefore,
  506.         ' fCreateShellGroup will abort setup, without returning, if there
  507.         ' is an error.
  508.         '
  509.         fCreateShellGroup strRemAutGroupName, False, False
  510.         'Now create the icons for AUTMGR32.EXE and RACMGR32.EXE
  511.         If Len(gsDest.strRACMGR32) > 0 Then
  512.             CreateShellLink gsDest.strRACMGR32, strRemAutGroupName, vbNullString, ResolveResString(resRACMGR32ICON), True, gsPROGMENUKEY, False
  513.         End If
  514.         If Len(gsDest.strAUTMGR32) > 0 Then
  515.             CreateShellLink gsDest.strAUTMGR32, strRemAutGroupName, vbNullString, ResolveResString(resAUTMGR32ICON), True, gsPROGMENUKEY, False
  516.         End If
  517.     End If
  518.     '
  519.     'Register the per-app path
  520.     '
  521.     If Len(gstrAppExe) > 0 Then
  522.         strPerAppPath = ReadIniFile(gstrSetupInfoFile, gstrINI_SETUP, gstrINI_APPPATH)
  523.         AddPerAppPath gstrAppExe, gsDest.strAppDir, strPerAppPath
  524.     End If
  525. ExitSetup:
  526.     HideStaticMessageDialog
  527.     If fWithinAction() Then
  528.         'By now, all logging actions should have been either aborted or committed.
  529.         MsgError ResolveResString(resSTILLWITHINACTION), vbExclamation Or vbOKOnly, gstrTitle
  530.         ExitSetup Me, gintRET_FATAL
  531.     End If
  532.     MoveAppRemovalFiles strGroupName
  533.     ExitSetup Me, gintRET_FINISHEDSUCCESS
  534. MainError:
  535.     iRet = MsgError(Err.Description & vbLf & vbLf & ResolveResString(resUNEXPECTED), vbRetryCancel Or vbExclamation, gstrTitle)
  536.     If gfNoUserInput Then iRet = vbCancel
  537.     Select Case iRet
  538.         Case vbRetry
  539.             Resume
  540.         Case vbCancel
  541.             ExitSetup Me, gintRET_ABORT
  542.             Resume
  543.     End Select
  544. End Sub
  545. '-----------------------------------------------------------
  546. ' SUB: HideCopyDialog
  547. ' Unloads the copy files status form
  548. '-----------------------------------------------------------
  549. Private Sub HideCopyDialog()
  550.     Unload frmCopy
  551. End Sub
  552. '-----------------------------------------------------------
  553. ' SUB: HideStaticMessageDialog
  554. ' Unloads the setup messages form
  555. '-----------------------------------------------------------
  556. Private Sub HideStaticMessageDialog()
  557.     Unload frmMessage
  558. End Sub
  559. '-----------------------------------------------------------
  560. ' SUB: ShowBeginForm
  561. ' Displays the begin setup form
  562. '-----------------------------------------------------------
  563. Private Sub ShowBeginForm()
  564.     If gfNoUserInput Then
  565.         If Not IsValidDestDir(gstrDestDir) Then
  566.             ExitSetup frmSetup1, gintRET_FATAL
  567.         End If
  568.     Else
  569.         frmBegin.Show vbModal
  570.     End If
  571. End Sub
  572. '-----------------------------------------------------------
  573. ' SUB: ShowCopyDialog
  574. ' Displays the copy files status form
  575. '-----------------------------------------------------------
  576. Private Sub ShowCopyDialog()
  577.     CenterForm frmCopy
  578.     If gfNoUserInput Then
  579.         frmCopy.cmdExit.Visible = False
  580.     End If
  581.     frmCopy.Show
  582.     frmCopy.Refresh
  583.     If frmCopy.cmdExit.Visible Then
  584.         frmCopy.cmdExit.SetFocus
  585.     End If
  586. End Sub
  587. '-----------------------------------------------------------
  588. ' SUB: ShowMainForm
  589. ' Displays the main setup 'blue wash' form
  590. '-----------------------------------------------------------
  591. Private Sub ShowMainForm()
  592.     Caption = gstrTitle
  593.     Show
  594.     DrawBackGround
  595.     Refresh
  596. End Sub
  597. '-----------------------------------------------------------
  598. ' SUB: ShowStaticMessageDialog
  599. ' Displays a setup message in a 'box' of the appropriate
  600. ' size for the message
  601. ' IN: [strMessage] - message to display
  602. '-----------------------------------------------------------
  603. Private Sub ShowStaticMessageDialog(ByVal strMessage As String)
  604.     Dim frm As Form
  605.     Set frm = frmMessage
  606.     frm.lblMsg.Caption = strMessage
  607.     '
  608.     'Default height is twice the height of the setup icon.
  609.     'If the height of the message text is greater, then
  610.     'increase the form height to the label height plus
  611.     'half an icon height
  612.     '
  613.     frm.ScaleHeight = frm.imgMsg.Height * 2
  614.     If frm.lblMsg.Height > frm.ScaleHeight Then
  615.         frm.ScaleHeight = frm.lblMsg.Height + frm.imgMsg.Height * 0.5
  616.     End If
  617.     '
  618.     'Vertically center the icon and label within the form
  619.     '
  620.     frm.imgMsg.Top = frm.ScaleHeight / 2 - frm.imgMsg.Height / 2
  621.     frm.lblMsg.Top = frm.ScaleHeight / 2 - frm.lblMsg.Height / 2
  622.     CenterForm frm
  623.     frm.Show
  624.     frm.Refresh
  625. End Sub
  626. '-----------------------------------------------------------
  627. ' SUB: ShowWelcomeForm
  628. ' Displays the welcome to setup form
  629. '-----------------------------------------------------------
  630. Private Sub ShowWelcomeForm()
  631.     If Not gfNoUserInput Then
  632.         frmWelcome.Show vbModal
  633.     End If
  634. End Sub
  635. '-----------------------------------------------------------
  636. ' SUB: GetStrings
  637. ' Loads string resources into global vars and forms/controls
  638. '-----------------------------------------------------------
  639. Private Sub GetStrings()
  640.     On Error GoTo GSErr
  641.     gstrSETMSG = ResolveResString(resSETMSG)
  642.     Exit Sub
  643. GSErr:
  644.     MsgError mstrRESOURCELOADFAIL, vbCritical Or vbOKOnly, vbNullString
  645.     ExitSetup Me, gintRET_FATAL
  646. End Sub
  647. Private Sub Form_Unload(Cancel As Integer)
  648.     CleanUpCabs
  649. End Sub
  650.